/**
 * JungoMobileWeb
 * JsonUtil.java
 * 
 * Copyright 2013 Teachizen
 * Written by cloudstick
 *	2013. 7. 26. first written.
 *
 * note:
 */
package com.jungo.web.util;

import java.util.ArrayList;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @author cloudstick
 *
 */
public class JsonUtil {
	public static <T> ArrayList<?> readValue(String content, Class<T> valueType) {
		ObjectMapper mapper = new ObjectMapper();
		try {
			return (ArrayList<?>) mapper.readValue(content, valueType);
		} catch (Exception e) {
			return null;
		}
	}
	
	public static String getJsonString(Object value) {
		ObjectMapper mapper = new ObjectMapper();
		try {
			return mapper.writeValueAsString(value);
		} catch (JsonProcessingException e) {
			return null;
		}
	}
}
